package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.WorkSpaceService;
import com.sky.vo.BusinessDataVO;
import com.sky.vo.DishOverViewVO;
import com.sky.vo.OrderOverViewVO;
import com.sky.vo.SetmealOverViewVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.Collections;
import java.util.List;

@RestController
@RequestMapping("/admin/workspace")
public class WorkSpaceController {
    @Autowired
    private WorkSpaceService workSpaceService;
    @GetMapping("/businessData")
    public Result<BusinessDataVO> getBusinessData(){
        List<LocalDate> dateList = Collections.singletonList(LocalDate.now());
        return Result.success(workSpaceService.getBusinessData(dateList));
    }

    @GetMapping("/overviewSetmeals")
    public Result<SetmealOverViewVO> overviewSetmeals(){
        return Result.success(workSpaceService.getSetmealOverView());
    }

    @GetMapping("/overviewDishes")
    public Result<DishOverViewVO> getDishOverView(){
        return Result.success(workSpaceService.getDishOverView());
    }

    @GetMapping("/overviewOrders")
    public Result<OrderOverViewVO> getOrderOverView(){
        return Result.success(workSpaceService.getOrderOverView());
    }
}
